<?php
/* @var $this CategoryController */
if($category != null){
   $stand_breadcrums = array(
      'Chuyên mục' => '/category',
      $category->cat_name,
   );
}else{
   $stand_breadcrums = array(
	  'Chuyên mục'
);
}

$this->breadcrumbs= $stand_breadcrums;
?>
<div class="cate-box">
   <div class="woocommerce">
      <ul class="list-products">
         <?php if(count($models) > 0){
            foreach($models as $book){
               $link = $model->linkDetail($book->book_id,$book->book_name);
               ?>
               <li class="product-item relative">
                  <a href="<?php echo $link?>">
                     <div class="left relative">
                        <?php if($book->book_sale > 0){?>
                        <div class="sale absolute">
                           <?php echo '-'.$book->book_sale.'%'?>
                        </div>
                        <?php }?>
                        <img alt="<?php echo $book->book_name?>" src="<?php echo Yii::app()->request->baseUrl?>/uploads/pictures/product/thumb_<?php echo $book->book_image?>" />
                     </div>
                     <div class="info">
                        <h3 class="font-12"><?php echo $book->book_name?></h3>
                        <p class="num-page">Số trang: <?php echo Str::formatNumber($book->book_num_page)?></p>
                        <p class="publisher">Nhà xuất bản: <?php echo $book->getRelated('publisher')->pub_name?></p>
                        <?php 
                           $new_price = $book->book_price  - round($book->book_price * ($book->book_sale/100),0);
                        ?>
                        <p class="price"><?php echo Str::formatNumber($new_price)?> đ</p>
                        <?php if($book->book_sale > 0){?>
                        <p class="old-price"><?php echo Str::formatNumber($book->book_price)?> đ</p>
                        <?php }?>
                     </div>
                  </a>
                  <div class="option absolute">
                     <p class="btn btn-info add-to-cart" onclick="adToCart(<?php echo $book->book_id?>)">Giỏ hàng</p>
                  </div>
               </li>
            <?php }
         }else{?>
         <div class="no-content">
            Không có sản phẩm nào thuộc chuyên mục này
         </div>
         <?php }?>
      </ul>
      <?php 
         $pagination->render();
      ?>
   </div>
</div>
